Salmon leaping at Willamette Falls from NOAA’s Historic Fisheries Collection. Unknown photographer, 27 June 1950.
Our overview goes here; includes
Hydroelectric power represents an important renewable and low-emissions energy source, but the construction and development of the water source that these plants can require sometimes threatens resident fish populations. Fishways have been constructed and updated over time at Willamette Falls to aid the passage of salmon and steelhead runs over the falls. Daily fish counts are monitored to ensure that migration of these fish populations continues to be unhindered by the power plant and the falls. This project summarizes findings from studying Willamette Falls monitoring data from 2001 to 2010.
Data were shared by and accessed from Columbia River DART:
Columbia River DART (Data Access in Real Time), Columbia Basin Research, University of Washington
Accessed Feb 1, 2021 at http://www.cbr.washington.edu/dart/query/adult_graph_text.
world <- ne_countries(scale = "medium", returnclass = "sf") # pull world data
states <- st_as_sf(map("state", plot = FALSE, fill = TRUE)) # pull state data
states <- cbind(states, st_coordinates(st_centroid(states))) # project
falls <- data.frame(longitude = c(-122.61763), latitude = c(45.35239)) %>% # make point
st_as_sf(coords = c("longitude", "latitude"), # as sf
crs = 4326, agr = "constant")
ggplot(data = world) + # plot
geom_sf(fill = "antiquewhite") +
geom_sf(data = states, fill = "peachpuff3") + # add state outlines and fill
geom_sf(data = falls, size = 4, shape = 23, fill = "royalblue3") + # add falls loc
coord_sf(xlim = c(-125, -110), ylim = c(40, 50), expand = FALSE) + # set bounding
theme_minimal() + # minimal theme
labs(title = "Willamette Falls location", # add labs
subtitle = "2001 - 2010",
caption = "Bri Baker, 2021")willamette_salmon <- read_csv(here("data", "willamette_fish_passage.csv")) %>% # read in data
clean_names() %>% # names in tidy format
select(date, coho, jack_coho, steelhead) %>% # select desired species
mutate(date = mdy(date)) %>% # make date class
as_tsibble(key = NULL, index = date) # convert to tsibble
salmon_longer <- willamette_salmon %>%
replace(is.na(.), 0) %>% # replace na with 0
pivot_longer(coho:steelhead, # consolidate species to one column
names_to = "species",
values_to = "counts") ggplot(salmon_longer, aes(x = date, y = counts, color = species)) + # make ggplot
geom_line() + #as a lineplot
labs(x = "Year", # add labs
y = "Count",
title = "Salmon counts at Willamette Falls fish passage",
subtitle = "2001 - 2010",
caption = "Bri Baker, 2021\nSource: Columbia River DART",
color = "Species") +
scale_color_manual(labels = c("Coho", "Jack Coho", "Steelhead"), # change legend names
values = c("aquamarine3", "cornflowerblue", "goldenrod1")) + # change colors
scale_x_date(date_breaks = "1 year", # show all years
date_labels = "%Y") +
theme_minimal() + # use theme_minimal
theme(legend.position = c(0.15, 0.75), # move legend
legend.background = element_rect(fill="white", linetype = "solid", color = "whitesmoke"), # format legend
axis.text.x = element_text(angle = 30, vjust = 1, hjust = 1)) # angle x labelssalmon_season <- willamette_salmon %>%
rename(Coho = coho,
"Jack Coho" = jack_coho,
Steelhead = steelhead) %>%
pivot_longer(Coho:Steelhead,
names_to = "species",
values_to = "counts")
salmon_season %>%
gg_season(counts)coho_subset <- willamette_salmon %>%
select(date, coho)
coho_subset %>%
gg_season(coho)jack_coho_subset <- willamette_salmon %>%
select(date, jack_coho)
jack_coho_subset %>%
gg_season(jack_coho)steelhead_subset <- willamette_salmon %>%
select(date, steelhead)
steelhead_subset %>%
gg_season(steelhead)gg_subseries(salmon_longer, period = "day")Issues I’m having: * I think the “year” variable I’m using is not a date type? Bri’s code for formatting the x-axis breaks isn’t working for me.; yeah its not of date class; i converted it, but what you had also works (just remove the mutate) * How to get the facets labeled with the proper names of the species?
# Using Bri's "pivot_longer-ed" df:
annual <- salmon_longer %>%
group_by_key() %>% # group by sp
index_by(yr = ~year(.)) %>% # index by year
summarize(annual_count = sum(counts)) %>% # sum counts by year and species
mutate(yr = as.Date(ISOdate(yr, 1, 1)))
species_labs <- c("Coho", "Jack Coho", "Steelhead") # capitalize
# Using Bri's graph formatting:
ggplot(data = annual, aes(x = yr, y = annual_count, fill = species)) + # make ggplot
geom_col() + #as a barchart
labs(x = "Year", # add labs
y = "Count",
title = "Salmon counts at Willamette Falls fish passage by year",
subtitle = "2001 - 2010",
caption = "Minnie Ringland, 2021\nSource: Columbia River DART") +
scale_fill_manual(values = c("aquamarine3", "cornflowerblue", "goldenrod1")) + # change colors
#scale_x_discrete(breaks = 2001:2011) +
scale_x_date(date_breaks = "1 year", # show all years #
date_labels = "%Y") +
theme_minimal() + # use theme_minimal
theme(legend.position = "none", # faceted so no legend
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) + # angle x labels
facet_wrap(~species,
labeller = labeller(species = species_labs))